<?php
class Mail
{

	private $email;
	private $subject;
	private $message;
	private $from;
	private $header;

	/*
	*Send mail
	*
	*
	*@param email: email
	*@param subject: subject of message
	*@param message: message
	*@param from: email of administrator
	*@param header: special headers
	*return true && create session variables of authorization || false
	*/	
	public function sendMail($email,$subject,$message,$from=null,$header=null)
	{
		$this->email = $email;
		$this->subject = $subject;
		$this->message = $message;

		if($from)
		{
			$this->from = $from;
		}
		else
		{
			$this->from = ADMIN_EMAIL;
		}
		if($header)
		{
			$this->header = $header;
		}
		else
		{
			$this->header =  "From: $this->from\r\n"
							."Reply-To: $this->from\r\n"
							."X-Mailer: PHP/" . phpversion();
		}
		if(mail($this->email,$this->subject, $this->message, $this->header))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}
